package com.sumainfor.pc.gmio.controller.cfo;

import com.sumainfor.pc.gmio.service.impl.cfo.CfoSearchServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 根据房源编号查询房源收入和支出
 * <p>
 *
 * @author: meng
 * @create: 2019-07-02 23:57
 **/
@Controller
@RequestMapping("/provider/key/CfoSearch")
public class CfoSearchController {

    @Autowired
    private CfoSearchServiceImpl cfoSearchService;

    /**
     * @Description //TODO 根据房源编号查询房源收入和房源支出, type为1查收入, type为2查支出
     * @return com.sumainfor.common.util.JsonResult
     * @Param [HouId, type]
     * @Date 2019/8/6 16:15
     **/
    @ResponseBody
    @PostMapping("/getOutAndInByHouseId")
    public List<Map<String, Object>> getOutAndInByHouseId(@RequestBody Map<String, Object> params, @RequestParam("type") Integer type){

        if (type == 1) {
            return cfoSearchService.getInByHouId(params);
        }
        return cfoSearchService.getOutByHouId(params);
    }
}
